package com.dt76.smallloanbackenduser.controller.ysy;

import com.dt76.smallloanbackenduser.remote.ysy.AccountRemote;
import com.dt76.smallloanbackenduser.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/ysy")
public class AccountController {
    //注入远程服务接口
    @Autowired
    private AccountRemote accountRemote;

    @RequestMapping("/account")
    public String account(Model model){
        model.addAttribute("qryAllList",accountRemote.qryAccountAll());

        System.out.println("调用远程服务成功！！");
        //System.out.println(accountRemote.qryAccountAll());
        return "pages/ysy/account";
    }

    @RequestMapping("/delacc/{yId}")
    @ResponseBody
    public Result delacc(@PathVariable String yId){
        return accountRemote.delacc(Integer.parseInt(yId));
    }

}